Code and Data to process, generate, and visualise mobility data from which to:
Create synthetic mobility estimates for any location with population estimates at any geographic scale;
Fit gravity model parameters and make predictions for location where no mobility data are available;
Fit radiation model parameters and make predictions for locations where no mobility data are available;
Processing and visualisation of passenger flights into Hanoi and HCMC, Vietnam.
This repository also includes code for bespoke visualisations comparing data with model estimates and maps of human mobility.
The gravity model estimates the movement from an origin location to a destination location using the population counts of both places and the distance between them. The total number of individual movements from a district \(i\) to a district \(j\), denoted by \(T_{i,j}\) is directly proportional to the population counts of both districts ( \(N_{i}\) , \(N_{j}\) ) and inversely proportional to the distance \(d_{i,j}\) between both districts.
\[T_{i,j} = k \frac{N_{i}^{\alpha} N_{j}^{\beta}}{d_{i,j}^{\gamma}}\]
where \(k, \alpha, \beta, \gamma\) are parameters fitted using observed human mobility data.
The radiation model estimates the commuter and mobility fluxes between locations. The model is based on the idea that an individual (e.g. a commuter or a traveller) makes decision in two steps. First, the individual can move to any location (including staying back at their home location). Each opportunity in a location has a benefit which is randomly chosen from a distribution. It is assumed that the larger the population of a location the more opportunities it offers, therefore, is more attractive to commuters/travellers from other locations. Second, the individual selects an opportunity from the closest location with higher benefits than those avaialble in their home locaiton. The priority in this step is given to reducing the commuting distance. The total number of movements \(T_{i,j}\) from a district \(i\) to district \(j\) is given by the following equation.
\[T_{i,j} = T_i \frac{N_i N_j}{(N_i+s_{i,j})(N_i+N_j+s_{i,j})}\]
where \(T_i\) is the total number of individuals who make a trip of non-zero distance, \(N_i\) and \(N_j\) are population counts in districts \(i\) and \(j\) respectively, and \(s_{i,j}\) is the total population that lives in the circle centered at district \(i\) having radius equal to the distance \(d_{i,j}\) between districts \(i\) and \(j\). The only parameter that needs to be inferred is the proportion of people that make a trip of non-zero distance which can be extracted from mobility data.
| Type of model | Data inputs | Mobility data | Outputs |
|---|---|---|---|
| Synthetic population for HCMC | HCMC Shapefile, gridded population | Co-location data for validation | Trajectories and time spent for each individual living in HCMC, Map of distribution of time spent (radius of gyration) |
| Gravity model | Population size in each commune, distance between commune centroids | Movement range maps | Gravity model parameters on weekday and weekend by month, comparison between data and model outputs, predictions for locations where there are no mobility data, maps of movements |
| Radiation model | Population size in each commune, distance between commune centroids | Movement range maps | Radiation model parameters by weekday and weekend and by month, comparisons between data and model outputs, predictions for locations where there are no mobility data, maps of movements |
You can report bugs, issues and suggestions for extra functions using the issues button on the right hand side of this page.